package com.kantboot.system.user.web.controller;

import com.kantboot.system.user.domain.dto.BalanceAddDTO;
import com.kantboot.system.user.domain.entity.SysBalanceChangeRecord;
import com.kantboot.system.user.service.ISysUserBalanceService;
import com.kantboot.util.common.result.RestResult;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.Map;

@RestController
@RequestMapping("/system-user-web/userBalance")
public class SysUserBalanceController {

    @Resource
    private ISysUserBalanceService service;

    @PostMapping("/changeBalance")
    public RestResult<SysBalanceChangeRecord> changeBalance(@RequestBody BalanceAddDTO dto) {
        return RestResult.success(service.changeBalance(dto),"addSuccess","添加成功");
    }

    @PostMapping("/getBalanceSelfMap")
    public RestResult<Map<String, BigDecimal>> getBalanceSelfMap() {
        return RestResult.success(service.getBalanceSelfMap(),"getSuccess","获取成功");
    }

}
